import java.util.Calendar;
import java.util.GregorianCalendar;

//测试日历类Calendar
public class TestCalendar {
    public static void main(String[] args) {
        // 得到相关日期元素
        GregorianCalendar calendar = new GregorianCalendar
                (2049,9,3,22,10,50);
        int year = calendar.get(Calendar.YEAR); //打印2049
        int month = calendar.get(Calendar.MONTH); //打印9
        int day = calendar.get(Calendar.DAY_OF_MONTH); //打印1
        int day2 = calendar.get(Calendar.DATE); //打印1

        // 日：calendar.DATE和Calendar.DAY_OF_MONTH同义
        int date = calendar.get(Calendar.DAY_OF_WEEK); //打印6

        // 星期几，这里是：1-7.周日是1，周二是2，周六是7
        System.out.println(year);
        System.out.println(month);
        System.out.println(day);
        System.out.println(day2);
        System.out.println(date);

        //设置日期
    }
}
